package r25.engine;

import r25.engine.IGameInstance.CHARACTER_ACTION;
import r25.room.IRoom;

public class CharacterActionResponse {

	public enum ERROR_REASON {
		OK, CANCELED_ACTION, INVALID_ACTION, INVALID_ROOM, INTERNAL_ERROR
	}

	private final boolean success;
	private final ERROR_REASON reason;
	private String message;
	private IRoom room;
	private CHARACTER_ACTION extraAction;

	public CharacterActionResponse() {
		super();
		this.success = true;
		this.reason = ERROR_REASON.OK;
	}

	public CharacterActionResponse(boolean success, ERROR_REASON reason) {
		super();
		this.success = success;
		this.reason = reason;
	}

	public boolean isSuccess() {
		return success;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("[success:");
		builder.append(success);
		builder.append(":");
		builder.append(reason);
		if (message != null) {
			builder.append(", ");
			builder.append("message=");
			builder.append(message);
		}
		if (room != null) {
			builder.append(", ");
			builder.append("room=");
			builder.append(room);
		}
		if (extraAction != null) {
			builder.append(", ");
			builder.append("extraAction=");
			builder.append(extraAction);
		}
		builder.append("]");
		return builder.toString();
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public IRoom getRoom() {
		return room;
	}

	public void setRoom(IRoom room) {
		this.room = room;
	}

	public ERROR_REASON getReason() {
		return reason;
	}

	public CHARACTER_ACTION getExtraAction() {
		return extraAction;
	}

	public void setExtraAction(CHARACTER_ACTION extraAction) {
		this.extraAction = extraAction;
	}
}
